﻿using UnityEngine;
using System.Collections;

public class Bar {

	public Data_Bar data;
	public Mob tap;
	public bool isTapping = false;
	public int patrons = 0;
	public int maxPatrons = 2;

	public void create() {
		tap = new Mob ();
		tap.create ("bar tap");
	}
	public void init(Data_Bar a) {
		data = a;
		tap.init (a.tapOff);
		patrons = 0;
	}
	public void upd() {
		tap.dataSprite = isTapping ? Tappa.game.data.tapOn : Tappa.game.data.tap;
		tap.upd ();
		if (patrons < maxPatrons) {
			if (Random.Range (1, 38767) <= 5*(maxPatrons - patrons)/* || patrons == 0*/) {
				Peep p = Tappa.game.peeps.get ();
				p.init (this);
				patrons++;
			}
		}
	}

}
